package com.yonyou.pmclouds.plan.entity;


import com.yonyou.pmclouds.basecom.entity.SuperVO;
import com.yonyou.pmclouds.plan.planindex.entity.PlanIndexVO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

@EqualsAndHashCode(callSuper = true)
@Data
@Table(name = "pm_project_plan")
public class ProjectPlanVO extends SuperVO {
    // 发现其实名字叫schedule会更合适一些，但是毕竟写了这么多代码了😔
    public static final String PK_PLAN = "pkPlan";
    public static final String DEPEND_PLAN = "dependPlan";
    public static final String EXPE_START_DATE = "expeStartDate";
    public static final String EXPE_END_DATE = "expeEndDate";
    public static final String EXPE_DURATION = "expeDuration";
    public static final String DESCRIPTION = "description";
    public static final String CHILD_COUNT = "childCount";
    public static final String SEQ = "seq";
    public static final String MANAGER = "manager";
    public static final String BILLSTATUS = "billstatus";
    public static final String LAST_FLAG = "lastFlag";
    public static final String INDEX_NUMBER = "indexNumber";
    public static final String COMPLETED_STATUS = "completedStatus";
    public static final String PK_MILESTONE = "pkMilestone";
    public static final String RELATED_BILL_TYPE = "relatedBillType";
    public static final String PK_DEPARTMENT = "pkDepartment";
    public static final String PLAN_FINISHER = "planFinisher";
    public static final String RELATED_PK_BILL = "relatedPkBill";

    @Id
    @NotNull(groups = UpdateValid.class)
    private String pkPlan;
    @NotNull(groups = InsertValid.class)
    private String pkTenant;
    @NotNull(groups = InsertValid.class)
    private String pkProject;
    @Size(max = 50)
    @NotNull
    private String sname;
    private String scode;
    /**
     * 顺序号,记录当前层级该节点的顺序
     */
    private int seq;
    /**
     * 前置计划
     */
    private String dependPlan;
    @Transient
    private String dependPlanName;
    /**
     * 计划开始日期
     */
    @NotNull
    private Date expeStartDate;

    /**
     * 计划完成日期
     */
    @NotNull
    private Date expeEndDate;

    /**
     * 工期
     */
    @NotNull
    private Integer expeDuration;
    /**
     * 描述
     */
    @Size(max = 300)
    private String description;
    /**
     * 负责人
     */
    @Column(name = "manager")
    private String manager;

    /**
     * 根节点
     */
    private String pkParent;
    private String pkRoot;
    private Integer childCount;
    private String creator;
    private Date creationtime;
    private String modifier;
    private Date modifytime;
    private String pkSrc;
    private byte billstatus;
    private int version;
    private String lastFlag;
    private String billType;
    private String historyPlan;//上一个版本的pkPlan
    /**
     * 关联里程碑
     */
    private String pkMilestone;
    /**
     * 关联单据类型
     */
    private String relatedBillType;
    /**
     * 指标数
     */
    private Integer indexNumber;
    /**
     * 计划进度完成状态
     */
    private Byte completedStatus;
    /**
     * nc部门
     */
    private String pkDepartment;
    /**
     * 计划完成人
     */
    private String planFinisher;
    /**
     * 驱动计划的单据主键(友工程或NC单据)
     */
    private String relatedPkBill;

    @Transient
    private String managerName;
    @Transient
    private String[] pictures;
    @Transient
    private ProjectPlanVO[] child;
    @Transient
    private ProjectPlanVO[] children;
    @Transient
    private String[] deletePlan;
    @Transient
    private PlanTempletVO templetVO;
    @Transient
    private String projectName;
    @Transient
    private String pkPlanwrite;
    @Transient
    private byte status;//计划填报的审批状态展示字段
    @Transient
    private String mark;//计划展示不展示标记
    @Transient
    private String departmentName;

    /**
     * 里程碑编码、名称
     */
    @Transient
    private String milestoneCode;
    @Transient
    private String milestoneName;
    /**
     * 关联单据类型名称
     */
    @Transient
    private String relatedBillTypeName;
    /**
     * 计划关联的指标
     */
    @Transient
    private List<PlanIndexVO> planIndexVOs;
    /**
     * 计划要删除的指标
     */
    @Transient
    private List<String> deletePlanIndexes;

    public interface UpdateValid {
    }

    public interface InsertValid {
    }
}
